﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NetFrameworkExtensions.Enterprise.Properties;

namespace NetFrameworkExtensions.Enterprise
{
  public static class ServiceManager
  {
    private static Func<IServiceManager> provider;

    public static IServiceManager Current { get { return provider(); } }

    public static void SetServiceManagerProvider(Func<IServiceManager> newProvider)
    {
      if (newProvider == null)
        throw new ArgumentNullException("newProvider");
      if (provider == null)
        provider = newProvider;
      else
        throw new InvalidOperationException(FormattedResources.CannotResetServiceManagerProvider);
    }
  }
}
